1. Field of the Invention
The present invention relates to an image processing apparatus and storage medium.
2. Description of the Related Art
Recently, it is a common practice to print an image on a recording material based on image data processed by a personal computer (PC), or display it on a display device. In print processing or display processing, when the number of gradations per pixel is compared before and after printing or display, the number of gradations expressible by the printing apparatus or display device is sometimes smaller than that of gradations expressing image data on the PC. Hence, when outputting image data to the printing apparatus or display device, halftone processing is often performed to convert image data of a large number of gradations into image data of a small number of gradations. However, halftone processing sometimes generates a jaggy at an edge portion contained in an image or disconnects a thin line, degrading the quality of a printed or displayed image.
As an example of halftone processing, there is known an ordered dither method of determining an output value (quantized value) by comparing a cyclically repeating threshold and an input value. It is known that when an input image contains a spatial frequency component close to a spatial frequency corresponding to the cycle of a threshold, the ordered dither method generates a moire corresponding to the difference from the spatial frequency of the threshold. At a portion containing a high spatial frequency component, such as a halftone character portion or the edge portion of a thin line, a quantization error is thus generated between an input image and an output image under the influence of quantization in halftone processing, decreasing the resolution of the appearance of the output image. This results in the jaggy of a character, line disconnection, or the like, degrading the image quality to obscure the contour of the character or the like.
As a technique for suppressing degradation of the image quality, for example, techniques in Japanese Patent Laid-Open Nos. 9-238259 and 2001-86355 have been proposed. Japanese Patent Laid-Open No. 9-238259 discloses a technique of detecting a moire component from the difference between input image data and image data having undergone halftone processing, and suppressing the detected moire component. In Japanese Patent Laid-Open No. 9-238259, difference data between input image data and image data having undergone halftone processing is obtained. Filter processing using a bandpass filter is performed for the obtained difference data, extracting a moire component. In accordance with the extracted moire component, the input image and the low frequency component signal of the input image are combined. Halftone processing is performed again for the obtained data, suppressing the moire component.
Japanese Patent Laid-Open No. 2001-86355 discloses a technique of detecting a moire component by performing filter processing based on visual characteristics for image data having undergone halftone processing. In Japanese Patent Laid-Open No. 2001-86355, filter processing based on visual characteristics is performed for each image data having undergone halftone processing, and image data obtained by shifting the phase of input image data by half and then performing halftone processing. After that, the difference between the obtained data is evaluated.
In some cases, an image or the like printed on a recording material based on image data having undergone halftone processing is copied. In other cases, an image is printed on a recording material by processing image data input by reading, by a scanner, an image or the like which is printed on a recording material after halftone processing. In these cases, image data input by reading a printed image by a copying apparatus, scanner, or the like has a lower resolution than that of image data before printing. Hence, it is difficult for the above-mentioned methods to detect only a moire from input image data at high accuracy. To solve this problem, for example, dot detection is executed by pattern detection or the like from input image data, a dot-detected portion is smoothed, and then halftone processing is performed.
However, when detecting dots from image data by pattern detection, patterns for pattern matching need to be prepared in accordance with the Lines Per Inch (LPI) or reading resolution, increasing the processing amount and circuit size. In pattern matching, a detection error or detection omission may occur. In this case, increasing the dot detection accuracy requires complicated processing including processing which refers to pixels in a wide range, isolated point processing, and expansion processing. Further, resolution conversion in smoothing processing decreases the image resolution in pixels containing high frequency components near the edge of an image or the like, degrading the image quality.
As another problem, when input image data contains a frequency component close to the frequency component of a moire component, it is hard for the conventional methods to discriminate a moire component generated by halftone processing from a component contained in the input image data.